package lab02.test23;

import com.sun.org.apache.xpath.internal.SourceTree;

import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

/**
 * Created by V555 on 2017/11/1.
 */
public class Test {
    public static void main(String[] args) {
        System.out.println("输入生日信息：");
        Scanner scanner=new Scanner(System.in);
        Calendar calendar=Calendar.getInstance();
        String str=scanner.nextLine();
        String year=str.substring(0,4);
        String month=str.substring(4,6);
        String day=str.substring(6);
        calendar.set(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(day));
        int week=calendar.get(Calendar.DAY_OF_WEEK);
        switch (week) {
            case 1:
                System.out.println("星期一");
                break;
            case 2:
                System.out.println("星期二");
                break;
            case 3:
                System.out.println("星期三");
                break;
            case 4:
                System.out.println("星期四");
                break;
            case 5:
                System.out.println("星期五");
                break;
            case 6:
                System.out.println("星期六");
                break;
            default:
                System.out.println("星期日");
                break;
        }
        Date datetwo=new Date();
        calendar.set(2017,Integer.parseInt(month),Integer.parseInt(day));
        Date dateone=calendar.getTime();
        long countDay=(dateone.getTime()-datetwo.getTime())/(24*60*60*1000);
        if (countDay<0){
            calendar.set(2018,Integer.parseInt(month),Integer.parseInt(day));
            dateone=calendar.getTime();
            countDay=(dateone.getTime()-datetwo.getTime())/(24*60*60*1000);
        }
        System.out.println("距离你的生日天数：");
        System.out.println(countDay);




    }

}


